/**
 * Rectangle.h
 *
 * Author:
 *   Chris Herbison
 *
 * Description:
 *   Class description for the Rectangle object.
 */

#ifndef RECTANGLE_H
#define RECTANGLE_H

#include "ray.h"
#include "Object.h"
#include "BoundingBox.h"
#include "PatchTree.h"
#include <vector>

const int NUM_PATCH_DIVISIONS = 8;
const int NUM_LIGHT_PATCHES = 2;

class Rectangle: public Object{
     public:
          Rectangle(IlluminationData _material, TextureData _texture,
                 Vector3 _normal, vector<Point3> _verticies, MyColor initialEnergy = MyColor(0,0,0,1));
          bool intersects(Ray r, IntersectData* data/*, ofstream* outf*/);
		  bool intersects(BoundingBox b);

		  Patch* findCorrespondingPatch(Point3 intersect, PatchTreeNode* curNode = NULL);
          
		  PatchTree patchTree;
          Vector3 normal;
          vector<Point3> verticies;
		  vector<Patch*> patches;
};

#endif